<template>
  <view class="evaluate">
    <view class="top" v-if="isTitle">
      <view class="title"> 评价 </view>
      <view class="more"> 查看更多 > </view>
    </view>
    <view class="tab-bar" v-if="isTab">
      <view class="tab-item a-item"> 全部 </view>
      <view class="tab-item"> 最新 </view>
      <view class="tab-item"> 好评 </view>
      <view class="tab-item"> 差评 </view>
      <view class="tab-item"> 有图 </view>
    </view>
    <!-- 评价详情 -->
    <view class="eva-details" v-for="item in 3" :key="item">
      <view class="eva-top">
        <view class="user-info">
          <image src="../static/logo.png" />
          <view class="user-name">
            <view class="name"> 横说竖说是事实</view>
            <view class="time"> 2024-11-04 </view>
          </view>
        </view>
        <view class="star">
          <image src="../static/icon/productDetails/a-collect.png" v-for="item in 5" :key="item" />
        </view>
      </view>
      <view class="eva-info">
        <view class="text">
          很不错，这家门店装修很好，卫生也做的很干净，店铺的位置离我家也很近，店铺很好，值得去。
        </view>
        <view class="img-box">
          <image src="../static/icon/product.png" v-for="item in 6" :key="item" />
        </view>
        <view class="reply">
          <view>商家回复：谢谢评价，我们会继续努力的！</view>
        </view>
      </view>
    </view>
  </view>
</template>

<script setup>
  defineProps({
    isTab: {
      type: Boolean,
      default: true
    },
    isTitle: {
      type: Boolean,
      default: true
    }
  })
</script>

<style lang="scss" scoped>
  .evaluate {
    background-color: #fff;
    padding: 14px 16px 10px;
    box-sizing: border-box;
    .top {
      display: flex;
      justify-content: space-between;
      align-items: center;
      .title {
        height: 19px;
        font-family: HarmonyOS Sans SC, HarmonyOS Sans SC;
        font-weight: 400;
        font-size: 16px;
        color: #333333;
        line-height: 19px;
      }
      .more {
        font-weight: 400;
        font-size: 12px;
        color: #999999;
        line-height: 14px;
      }
    }
    .tab-bar {
      display: flex;
      margin-top: 10px;
      margin-bottom: 6px;
      .tab-item {
        width: 44px;
        height: 22px;
        color: #666666;
        background: #F0F0F0;
        font-size: 12px;
        border-radius: 4px;
        margin-right: 4px;
        text-align: center;
        line-height: 22px;
        &.a-item {
          color: #FF3B1E;
          background: #FFEFF1;
        }
      }
    }
    // 评价详情
    .eva-details {
      margin-top: 10px;
      padding-bottom: 10px;
      border-bottom: 1px solid #E6E6E6;
      .eva-top {
        display: flex;
        justify-content: space-between;
        align-items: center;
        .user-info {
          display: flex;
          image {
            width: 32px;
            height: 32px;
            margin-right: 10px;
          }
          .name {
            font-weight: 500;
            font-size: 14px;
            color: #666666;
            line-height: 17px;
          }
          .time {
            font-weight: 400;
            font-size: 12px;
            color: #999999;
            line-height: 16px;
          }
        }
        .star {
          image {
            width: 12px;
            height: 12px;
          }
        }
      }
      .eva-info {
        margin-top: 10px;
        .text {
          font-weight: 400;
          font-size: 14px;
          color: #666666;
          line-height: 19px;
        }
        .img-box {
          margin: 10px 0;
          display: grid;
          grid-template-columns: repeat(3, 1fr); /* 创建5列 */
          gap: 9px; /* 如果需要间距，可以设置为非零值 */
          box-sizing: border-box; /* 确保内边距不会增加容器大小 */
          image {
            width: 109px;
            height: 109px;
          }
        }
        .reply {
          padding: 6px 10px;
          background: #F4F4F4;
          border-radius: 5px 5px 5px 5px;
          view {
            font-weight: 400;
            font-size: 14px;
            color: #999999;
            line-height: 19px;
          }
        }
      }
    }
  }
</style>